package StudyCode.summary.myfile;

import java.io.IOException;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class UsingFilesNewOutputStreamMethod {
	public static void main(String[] args) {

		Path path = Paths.get("E:\\Copy", "test.txt");
		String str = "www.tah1986.com";

		byte data[] = str.getBytes();
		try (OutputStream outputStream = Files.newOutputStream(path)) {
			outputStream.write(data);
		} catch (IOException e) {
			System.err.println(e);
		}
		System.out.println("写入成功。");
	}
}
